package com.compmov.socialnetwork;

import android.app.TabActivity;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.util.Log;
import android.widget.TabHost;


public class Pestanias extends TabActivity  {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.detalles);
        Resources res = getResources(); // Resource object to get Drawables
        TabHost tabHost = getTabHost();  // The activity TabHost
        TabHost.TabSpec spec;  // Resusable TabSpec for each tab
        Intent intent;  // Reusable Intent for each tab
        String id;
        String nombre;
        String descripcion;
        String ranking;
        String url;
        String address;
        
        Bundle extras = getIntent().getExtras();
        id = extras.getString("id_lugar");        
        nombre=extras.getString("nombre");
        descripcion=extras.getString("descripcion");
        ranking=extras.getString("ranking");
        url=extras.getString("url");
        address=extras.getString("address");
        Log.d("WEBSERVICE", "ID Pestanias"+id);
        // Create an Intent to launch an Activity for the tab (to be reused)
        intent = new Intent().setClass(this, Lugar.class);
        intent.putExtra("id_lugar",id);      
		intent.putExtra("nombre", nombre);
		intent.putExtra("ranking", ranking);
		intent.putExtra("descripcion", descripcion);
		intent.putExtra("url", url);
		intent.putExtra("address", address);

        
        // Initialize a TabSpec for each tab and add it to the TabHost
        spec = tabHost.newTabSpec("Lugar").setIndicator("Lugar",
                          res.getDrawable(R.drawable.googlemaps))
                      .setContent(intent);
        
        tabHost.addTab(spec);
       

        // Do the same for the other tabs
        intent = new Intent().setClass(this, Comments.class);
        intent.putExtra("id_lugar",id);
        spec = tabHost.newTabSpec("Comentarios").setIndicator("Comentarios",
                          res.getDrawable(R.drawable.comments))
                      .setContent(intent);
        
        tabHost.addTab(spec);

        
        // Do the same for the other tabs
        intent = new Intent().setClass(this, Photos.class);
        intent.putExtra("id_lugar",id);
        spec = tabHost.newTabSpec("Imagenes").setIndicator("Imagenes",
                          res.getDrawable(R.drawable.icono_galeria))
                      .setContent(intent);
        tabHost.addTab(spec);

        tabHost.setCurrentTab(0);
    }
}
